# 设置基础配置类
import logging
import redis


class Config(object):

    # 设置启动模式，秘钥
    DEBUG=True
    SECRET_KEY = 'JDEIFI3'

    # 数据库配置
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@localhost:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS =False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    # redis设置
    REDIS_HOST ='127.0.0.1'
    REDIS_PORT =6379

    # 设置session配置信息
    SESSION_TYPE = 'redis'
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = 3600*24*2

    # 设置默认日志级别
    LEVEL = logging.DEBUG

# 开发环境配置信息
class DevelopConfig(Config):
    pass

# 生产环境配置信息
class ProductConfig(Config):
    DEBUG = False
    LEVEL = logging.ERROR

# 测试环境配置信息
class TestingConfig(Config):
    TESTING = True

config_dict = {
    "develop":DevelopConfig,
    "product":ProductConfig,
    "testing":TestingConfig,
}